var mongoose = require('mongoose'); // 引用mongoose模块
mongoose.Promise = global.Promise
// var db = mongoose.createConnection('192.168.1.112', 'test'); //创建一个数据库连接
// var db = mongoose.createConnection('mongodb://test:test.com@192.168.1.112:27017/test'); // 创建一个数据库连接
mongoose.connect('mongodb://test:test.com@192.168.2.59:27017/test');
var db = mongoose.connection;
db.on('error', console.error.bind(console, '连接错误')); // 连接错误
db.on('open', function () {
  // 一次打开记录
  console.log('connection success')
})
module.exports = db;
